<template>
  <div>
    <table border="1">
      <th>姓名</th>
      <th>性别</th>
      <tr v-for="(item, index) in kkk" :key="index">
        <td>{{ item.text }}</td>
        <td>
          {{ item.state
          }}<input type="checkbox" :checked="item.state ? true : false" />
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      kkk: [],
      table: [
        {
          cell1: { text: "李四1", state: true },
          cell2: { text: "李四4", state: true },
          cell3: { text: "李四13", state: true },
        },
        {
          cell: { text: "李四1", state: true },
          cell2: { text: "李四2", state: true },
          cell3: { text: "李四13", state: false },
        },
        {
          cell: { text: "王五7", state: true },
          cell2: { text: "李四2", state: true },
          cell3: { text: "李四9", state: false },
        },
      ],
    };
  },
  created() {
    this.creas();
  },
  //计算属性实现
  // computed: {
  //   kets() {
  //     this.table.forEach(i => {
  //       for (const key in i) {
  //           this.dingkes.push(i[key]);
  //       }
  //     });
  //     return this.dingkes

  //   },
  // },
  methods: {
    creas() {
      //  this.table.map(item=>Object.values(item).flat)
      // this.table.forEach((val) => {
      //     // console.log(val);
      //     for (const key in val) {
      //         console.log(val[key]);
      //          this.dingkes.push(val[key]);
      //     }
      // //   Object.values(val);
      // //   this.dingkes.push(...Object.values(val));
      // // //   console.log(this.dingkes)
      // });
    },
  },
};
</script>

<style lang="less" scope></style>
